package com.jingdianjichi.subject.application.controller;

import com.jingdianjichi.subject.common.utils.LoginUtil;
import com.jingdianjichi.subject.infra.rpc.entity.UserInfo;
import com.jingdianjichi.subject.infra.rpc.UserRPC;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 测试微服务打通测试
 */
@RestController
@RequestMapping("/test/feign")
@Slf4j
public class TestFeignController {

    //注入RPC
    @Resource
    private UserRPC userRPC;

    @GetMapping("/getUserInfo")
    public UserInfo testFeign(){
        UserInfo userInfo = userRPC.getUserInfo(LoginUtil.getLoginId());

        log.info("TestFeignController.testFeign.userInfo:{}",userInfo);

        return userInfo;
    }

}
